<html>
<head><meta charset="utf-8"><title>Clippy is trying to dynamically load libstd?? · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html">Clippy is trying to dynamically load libstd??</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="211699610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211699610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211699610">(Sep 29 2020 at 23:53)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/77309#issuecomment-701051237">https://github.com/rust-lang/rust/issues/77309#issuecomment-701051237</a></p>



<a name="211701046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701046">(Sep 30 2020 at 00:10)</a>:</h4>
<p>It shouldn't be sysroot. I fixed that a while ago: <a href="https://github.com/rust-lang/rust-clippy/commit/f5db351a1d502cb65f8807ec2c84f44756099ef3">https://github.com/rust-lang/rust-clippy/commit/f5db351a1d502cb65f8807ec2c84f44756099ef3</a> Clippy and rustc should now always print the same sysroot. This is tested in our CI.</p>



<a name="211701142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701142">(Sep 30 2020 at 00:12)</a>:</h4>
<p>I think the issue was that clippy was looking at the rustc in PATH, not the <code>RUSTC</code> env var</p>



<a name="211701156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701156">(Sep 30 2020 at 00:12)</a>:</h4>
<p>context: <a href="https://github.com/rust-lang/rust/pull/77351/commits/59890ae48b00fbe8204f7217ec7ea70e3cd00038">https://github.com/rust-lang/rust/pull/77351/commits/59890ae48b00fbe8204f7217ec7ea70e3cd00038</a></p>



<a name="211701312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701312">(Sep 30 2020 at 00:14)</a>:</h4>
<p>Oh yeah, if no sysroot is set at all (via <code>--sysroot</code> or env var), Clippy asks the rustc binary for the sysroot: <a href="https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L325-L333">https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L325-L333</a></p>



<a name="211701341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701341">(Sep 30 2020 at 00:15)</a>:</h4>
<p>also this comment: <a href="https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L307">https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L307</a></p>



<a name="211701345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701345">(Sep 30 2020 at 00:15)</a>:</h4>
<p>right, it should consider <code>$RUSTC</code> before <code>rustc</code></p>



<a name="211701354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701354">(Sep 30 2020 at 00:15)</a>:</h4>
<p>it matters for bootstrap because <code>$RUSTC</code> has a different sysroot</p>



<a name="211701425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701425">(Sep 30 2020 at 00:16)</a>:</h4>
<p>Yes. I wonder if we need the sysroot handling in Clippy at all <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="211701475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701475">(Sep 30 2020 at 00:17)</a>:</h4>
<p>apparently yes: <a href="https://github.com/rust-lang/rust-clippy/pull/3546">https://github.com/rust-lang/rust-clippy/pull/3546</a></p>



<a name="211701596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701596">(Sep 30 2020 at 00:18)</a>:</h4>
<p>yep, this comment exists until today: <a href="https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L394-L400">https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L394-L400</a></p>
<p>So I think we need it to not have to link std etc. if <code>clippy-driver</code> is used directly.</p>



<a name="211701729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701729">(Sep 30 2020 at 00:20)</a>:</h4>
<p>The <code>src/</code> dir of Clippy is just hacks no-one likes to touch, because it would probably break something <span aria-label="smiley" class="emoji emoji-1f603" role="img" title="smiley">:smiley:</span></p>



<a name="211701780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701780">(Sep 30 2020 at 00:21)</a>:</h4>
<p>I'll see if I can add <code>RUSTC</code> support to clippy, then I wouldn't have to hack around it on the bootstrap side</p>



<a name="211701962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211701962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211701962">(Sep 30 2020 at 00:24)</a>:</h4>
<p>Instead of <code>Command::new("rustc")</code> you could do something like <code>Command::new(env::var("RUSTC").unwrap_or("rustc"))</code> here: <a href="https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L326">https://github.com/rust-lang/rust-clippy/blob/99483be1c7629a17fad45b9c208982c3891639e3/src/driver.rs#L326</a></p>



<a name="211702122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702122">(Sep 30 2020 at 00:27)</a>:</h4>
<p>I suggest to do that in the rust-lang/rust copy of Clippy, so we don't need to sync to test this.</p>



<a name="211702135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702135">(Sep 30 2020 at 00:27)</a>:</h4>
<p>will do</p>



<a name="211702211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702211">(Sep 30 2020 at 00:28)</a>:</h4>
<p>Thanks! -&gt; <span aria-label="in bed" class="emoji emoji-1f6cc" role="img" title="in bed">:in_bed:</span> time for me</p>



<a name="211702238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702238">(Sep 30 2020 at 00:29)</a>:</h4>
<p>hmm, this is odd - <code>cargo clippy --fix</code> on libstd does nothing, despite there being 2000 warnings</p>



<a name="211702242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702242">(Sep 30 2020 at 00:29)</a>:</h4>
<p>you'd think at least one would be machine applicable</p>



<a name="211702374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702374">(Sep 30 2020 at 00:31)</a>:</h4>
<p>rustfix does nothing if it breaks something, IIRC (And Clippz suggestions probably break something when triggering 2000 times). But maybe there is a flag/env var for rustfix, that forces rustfix to fix, even though it produces compiler errors?</p>



<a name="211702453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702453">(Sep 30 2020 at 00:32)</a>:</h4>
<p>yeah, it's <code>__CARGO_FIX_YOLO=1</code> but I don't know how to set it: <a href="#narrow/stream/246057-t-cargo/topic/Does.20cargo.20pass.20--sysroot.3F/near/211702305">https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Does.20cargo.20pass.20--sysroot.3F/near/211702305</a></p>



<a name="211702467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Clippy%20is%20trying%20to%20dynamically%20load%20libstd%3F%3F/near/211702467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Clippy.20is.20trying.20to.20dynamically.20load.20libstd.3F.3F.html#211702467">(Sep 30 2020 at 00:32)</a>:</h4>
<p>such a great name <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>